<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>编辑图书</title>
	<%@ include file="/pages/common/base_js_jq.jsp"%>
	<script src="/static/js/jquery.form.js"></script>
<style type="text/css">
	h1 {
		text-align: center;
		margin-top: 200px;
	}
	
	h1 a {
		color:red;
	}
	
	input {
		text-align: center;
	}
</style>
</head>
<body>
		<div id="header">
			<%--../../static/img/logo.gif--%>
			<img class="logo_img" alt="" src="static/img/logo.gif" >
			<span class="wel_word">编辑图书</span>
			<%@ include file="/pages/common/manager_head.jsp"%>
		</div>

		<div id="main">
			<form action="addBook" method="post">
				<table>
					<tr>
						<td>名称</td>
						<td>价格</td>
						<td>作者</td>
						<td>销量</td>
						<td>库存</td>
						<td>类型</td>
						<td colspan="2">操作</td>
					</tr>
					<tr>
						<td><input name="name" type="text"/></td>
						<td><input name="price" type="text"/></td>
						<td><input name="author" type="text"/></td>
						<td><input name="sales" type="text"/></td>
						<td><input name="stock" type="text"/></td>
						<td>
							<select name="type"  >
								<option>请选择</option>
								<c:forEach items="${type}" var="type">
									<option value="${type.typename}">${type.typename}</option>
								</c:forEach>
							</select>
						</td>
							<input  id="imgPath" name="imgPath">
						<td><input type="submit" value="提交"/></td>
					</tr>
				</table>
			</form>

			<form enctype="multipart/form-data" method="post" id="heardFrom">
				<table>
				<tr>
					<td>头图</td>
					<td><input name="heardImg" type="file"/></td>
					<td><input type="button" value="上传" id="btn"/></td>
				</tr>
				<tr>
					<td colspan="3">
						<img src="" id="heardImg" width="200">
					</td>
				</tr>
				</table>
			</form>

		</div>
		<%@ include file="/pages/common/footer_all.jsp"%>

		<script>
            $("#btn").click(function () {
                $("#heardFrom").ajaxSubmit({
                    url:"uploadHeard",
                    type:"post",
                    success:function (data) {
                        $("#heardImg").attr("src",data)
						$("#imgPath").val(data)
                    }
                })
            })
		</script>
</body>
</html>